![](/images/logolthin300.png)
Use neopixels to add impressive light displays or data visualisations to your project
The colours of the wires can vary, so check the lettering on the end of the neopixel strip to connect correctly Connect to the Pico as follows:
Circuit | Pico |
---|---|
5V | 3V3 |
Black | GND |
DI or DIn | GP2 or another GP pin |
You need to add the neopixel library. Copy neopixel.py from the lib directory on github to the lib directory on the pico:
Write this code and download to the Pico.
See code on github# Test neopixel
import board
import neopixel
# Set the number of pixels connected
num_pixels = 30
# Create the neopixel object
pixels = neopixel.NeoPixel(board.GP22, num_pixels)
# Set the broghtness level (from 0 to 1)
pixels.brightness = 1
# Set the colours of all pixels
pixels.fill((255, 0, 0))
# Set the colours of pixels individually
pixels[0] = (0,255,0) # green
pixels[1] = (0,0,255) # blue
pixels[2] = (255,255,255) # white
The library documentation can be found here.
The original library can be found here.